
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> no </title>
<link rel="shortcut icon" href="/static/images/favicon.ico?v=ae96a36ce8516b5dce69540af0112067" type="image/x-icon">
</head>
<body>

<style>
*{
font-family: "微软雅黑";
}
#login, #register{
text-align: center;
margin:0px auto;
width:400px;
height: 200px;
background: rgba(0,0,0,0.1);
border-radius: 4%;
display: none;
}
.title{
padding-top: 30px;
}
.form{
/*padding-top: 10px;*/
}
#content{
margin: 0 auto;
text-align: center;
width: 800px;
height:340px;
background-image: url("http://www.d2ziran.com/public/upload/nofix/20161205/1612050107133xwq.jpg");
/*margin-top: 30px;*/
}
</style>
<div id="content" >
<h1>欢迎光临侠仔的火车票!</h1>

abbb 还没登陆<button id="gologin" onclick="gologin();">登陆</button>&nbsp;<button id="register_button" onclick="goregister();">注册</button>

</div>
<div id="main">
<div id="login">
<h3 class="title">登陆</h3>
<div class="form">
<p>用户名:<input id="username" type="text" name="username" placeholder="请输入用户名" /></p>
<p>密 码: <input id="password" type="password" name="password" placeholder="请输入密码"/></p>
<button type="submit" onclick="login();">登录</button>
<button type="cancle" onclick="cancel();">取消</button>
</div>
</div>
<div id="register">
<h4>注册</h4>
<div class="form">
<p>用户名:<input id="username1" type="text" name="username" placeholder="请输入用户名" /></p>
<p>密 码: <input id="password1" type="password" name="password" placeholder="请输入密码"/></p>
<p>再次输入: <input id="password2" type="password" name="password2" placeholder="再次输入密码"/></p>
<button type="submit" onclick="register();">注册</button>
<button type="cancle" onclick="cancel();">取消</button>
</div>
</div>
</div>
<script type="text/javascript">
var dl=document.getElementById("gologin");
var dlk=document.getElementById("login");
var dzc=document.getElementById("register");
function cancel(){
dlk.style.display="none";
dzc.style.display="none";
};
function gologin(){
dzc.style.display="none";
dlk.style.display="block";
}
function goregister(){
dlk.style.display="none";
dzc.style.display="block";
}
function login(){
if (window.ActiveXObject) {
xml = new ActiveXObject("winhttp.winhttprequest.5.1");
}
else {
xml = new XMLHttpRequest();
}
xml = new XMLHttpRequest();
xml.open("POST", "/login", true);
var username=document.getElementById("username").value;
var password=document.getElementById("password").value;
var postdata = "username="+username+"&password="+password;
xml.onreadystatechange = function () {
if (xml.status == 200 && xml.readyState == 4) {
//alert(xml.response);
alert("登陆成功!");
// getId("bottom").style.background = "#ff6f3d";
dlk.style.display="none";
document.getElementById("content").innerHTML=xml.response;
}
}
xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xml.send(postdata);
}
function register(){
if (window.ActiveXObject) {
xml = new ActiveXObject("winhttp.winhttprequest.5.1");
}
else {
xml = new XMLHttpRequest();
}
xml = new XMLHttpRequest();
xml.open("POST", "/register", true);
var username=document.getElementById("username1").value;
var password=document.getElementById("password1").value;
var password2=document.getElementById("password1").value;
var postdata = "username="+username+"&password="+password+"&password2="+password2;;
xml.onreadystatechange = function () {
if (xml.status == 200 && xml.readyState == 4) {
//alert(xml.response);
alert("登陆成功!");
// getId("bottom").style.background = "#ff6f3d";
dzc.style.display="none";
document.getElementById("content").innerHTML=xml.response;
}
}
xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xml.send(postdata);
}
</script>

<br>


</body>
</html>